package com.oracle.jimu.action;

import java.sql.SQLException;
import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

import com.opensymphony.xwork2.ActionSupport;
import com.oracle.jimu.bean.SubType;
import com.oracle.jimu.bean.SuperType;
import com.oracle.jimu.dao.SubDao;
import com.oracle.jimu.dao.SubDaoImpl;
import com.oracle.jimu.dao.SuperDao;
import com.oracle.jimu.dao.SuperDaoImpl;
import com.oracle.jimu.service.SubTypeService;
import com.oracle.jimu.service.SuperTypeService;

public class SubAction extends ActionSupport {
	private SubTypeService subService;
	private SuperTypeService superService;
	
	private List<SubType> subList;
	private Integer subid;
	private SubType subtype;
	private List<SuperType> superList;
	

	
	public SuperTypeService getSuperService() {
		return superService;
	}

	public void setSuperService(SuperTypeService superService) {
		this.superService = superService;
	}

	public SubTypeService getSubService() {
		return subService;
	}

	public void setSubService(SubTypeService subService) {
		this.subService = subService;
	}

	public List<SuperType> getSuperList() {
		return superList;
	}

	public void setSuperList(List<SuperType> superList) {
		this.superList = superList;
	}


	public List<SubType> getSubList() {
		return subList;
	}

	public void setSubList(List<SubType> subList) {
		this.subList = subList;
	}

	public Integer getSubid() {
		return subid;
	}

	public void setSubid(Integer subid) {
		this.subid = subid;
	}

	public SubType getSubtype() {
		return subtype;
	}

	public void setSubtype(SubType subtype) {
		this.subtype = subtype;
	}

	public String subList() {
			
		subList=subService.getSubs();		
		
		return SUCCESS;
	}
	public String toaddSub(){
	
		superList=superService.getSupers();
		
		return SUCCESS;
	}
	
	public String addSub() {
		subService.addSub(subtype);
	
		return SUCCESS;
	}
	public String delSub() {
		
		subService.delSub(subid);
	
		
		return SUCCESS;
	}
	
	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		return SUCCESS;
	}
}
